import unittest
from time import sleep
from selenium import webdriver
from selenium.webdriver.firefox.options import Options
import Login


class mytest02(unittest.TestCase):
    def setUp(self):
        self.driver =Login.login()
    def test_zhengxiang_02(self):
        self.driver.find_element('link text', '文档管理').click()
        sleep(1)
        self.driver.find_element('link text', '我的文档').click()
        sleep(1)
        ele1 = self.driver.find_element('css selector', '#iframe_main')  # 进入ZZH文件层
        self.driver.switch_to.frame(ele1)
        self.driver.find_element('link text','ZZH').click()
        sleep(1)
        self.driver.find_element('css selector', '#myform > div:nth-child(2) > div:nth-child(2) > button:nth-child(1)').click() #上传文档
        sleep(1)
        self.driver.switch_to.default_content()
        ele2= self.driver.find_element('css selector', '.d-content > iframe:nth-child(1)')
        self.driver.switch_to.frame(ele2)
        file_path=r'C:\Users\PC\Desktop\新建文件夹 (2)\b_18a2916f2fda3053e4be3b81f9760681.jpg'
        self.driver.find_element('css selector', '#file').send_keys(file_path)
        self.driver.find_element('id', 'button_upload').click()
        sleep(5)
    def tearDown(self) -> None:
        self.driver.close()
if __name__ == '__main__':
    unittest.main()